Note aws-amplify 5 has been released. If you are looking for upgrade guidance click here
AWS Amplify provides a declarative and easy-to-use interface across different categories of cloud operations. AWS Amplify goes well with any JavaScript based frontend workflow and React Native for mobile developers.
Our default implementation works with Amazon Web Services (AWS), but AWS Amplify is designed to be open and pluggable for any custom backend or service.
| Category | AWS Provider | Description |
|---|---|---|
| Authentication | Amazon Cognito | APIs and Building blocks to create Authentication experiences. |
| Analytics | Amazon Pinpoint | Collect Analytics data for your application including tracking user sessions. |
| REST API | Amazon API Gateway | Sigv4 signing and AWS auth for API Gateway and other REST endpoints. |
| GraphQL API | AWS AppSync | Interact with your GraphQL or AWS AppSync endpoint(s). |
| DataStore | AWS AppSync | Programming model for shared and distributed data, with simple online/offline synchronization. |
| Storage | Amazon S3 | Manages content in public, protected, private storage buckets. |
| Geo (Developer preview) | Amazon Location Service | Provides APIs and UI components for maps and location search for JavaScript-based web apps. |
| Push Notifications | Amazon Pinpoint | Allows you to integrate push notifications in your app with Amazon Pinpoint targeting and campaign management support. |
| Interactions | Amazon Lex | Create conversational bots powered by deep learning technologies. |
| PubSub | AWS IoT | Provides connectivity with cloud-based message-oriented middleware. |
| Internationalization | --- | A lightweight internationalization solution. |
| Cache | --- | Provides a generic LRU cache for JavaScript developers to store data with priority and expiration settings. |
| Predictions | Various* | Connect your app with machine learning services like NLP, computer vision, TTS, and more. |
AWS Amplify is available as aws-amplify on npm.
To get started pick your platform from our Getting Started home page
If you are using default exports from any Amplify package, then you will need to migrate to using named exports. For example:
- import Amplify from 'aws-amplify';
+ import { Amplify } from 'aws-amplify'
- import Analytics from '@aws-amplify/analytics';
+ import { Analytics } from '@aws-amplify/analytics';
// or better
+ import { Analytics } from 'aws-amplify';
- import Storage from '@aws-amplify/storage';
+ import { Storage } from '@aws-amplify/storage';
// or better
+ import { Storage } from 'aws-amplify';
Datastore predicate syntax has changed, impacting the DataStore.query, DataStore.save, DataStore.delete, and DataStore.observe interfaces. For example:
- await DataStore.delete(Post, (post) => post.status('eq', PostStatus.INACTIVE));
+ await DataStore.delete(Post, (post) => post.status.eq(PostStatus.INACTIVE));
- await DataStore.query(Post, p => p.and( p => [p.title('eq', 'Amplify Getting Started Guide'), p.score('gt', 8)]));
+ await DataStore.query(Post, p => p.and( p => [p.title.eq('Amplify Getting Started Guide'), p.score.gt(8)]));
npm install -g @aws-amplify/cliamplify codegen modelsStorage.list has changed the name of the maxKeys parameter to pageSize and has a new return type that contains the results list. For example:
- const photos = await Storage.list('photos/', { maxKeys: 100 });
- const { key } = photos[0];
+ const photos = await Storage.list('photos/', { pageSize: 100 });
+ const { key } = photos.results[0];
Storage.put with resumable turned on has changed the key to no longer include the bucket name. For example:
- let uploadedObjectKey;
- Storage.put(file.name, file, {
- resumable: true,
- // Necessary to parse the bucket name out to work with the key
- completeCallback: (obj) => uploadedObjectKey = obj.key.substring( obj.key.indexOf("/") + 1 )
- }
+ let uploadedObjectKey;
+ Storage.put(file.name, file, {
+ resumable: true,
+ completeCallback: (obj) => uploadedObjectKey = obj.key
+ }
Analytics.record no longer accepts string as input. For example:
- Analytics.record('my example event');
+ Analytics.record({ name: 'my example event' });
The JS export has been removed from @aws-amplify/core in favor of exporting the functions it contained.
Any calls to Amplify.Auth, Amplify.Cache, and Amplify.ServiceWorker are no longer supported. Instead, your code should use the named exports. For example:
- import { Amplify } from 'aws-amplify';
- Amplify.configure(...);
- // ...
- Amplify.Auth.signIn(...);
+ import { Amplify, Auth } from 'aws-amplify';
+ Amplify.configure(...);
+ // ...
+ Auth.signIn(...);
@react-native-community/netinfo@react-native-async-storage/async-storage// React Native
yarn add aws-amplify amazon-cognito-identity-js @react-native-community/netinfo @react-native-async-storage/async-storage
npx pod-install
// Expo
yarn add aws-amplify @react-native-community/netinfo @react-native-async-storage/async-storage
AWS.credentials and AWS.config don’t exist anymore in Amplify JavaScript.aws-sdk@2.x has been removed from Amplify@3.x.x in favor of version 3 of aws-sdk-js. We recommend to migrate to aws-sdk-js-v3 if you rely on AWS services that are not supported by Amplify, since aws-sdk-js-v3 is imported modularly.If you can't migrate to aws-sdk-js-v3 or rely on aws-sdk@2.x, you will need to import it separately.
If you are using exported paths within your Amplify JS application, (e.g. import from "@aws-amplify/analytics/lib/Analytics") this will now break and no longer will be supported. You will need to change to named imports:
import { Analytics } from 'aws-amplify';
If you are using categories as Amplify.<Category>, this will no longer work and we recommend to import the category you are needing to use:
import { Auth } from 'aws-amplify';
For more information on contributing to DataStore / how DataStore works, see the DataStore Docs
Custom domain endpoint for GraphQL API.
Optional region string used to sign the request to customEndpoint. Effective only if customEndpoint is
specified, and the auth mode is 'iam'.
Default auth mode for all the API calls to given service.
Required GraphQL endpoint, must be a valid URL string.
Optional region string used to sign the request. Required only if the auth mode is 'iam'.
Required REST endpoint, must be a valid URL string.
Optional region string used to sign the request with IAM credentials. If Omitted, region will be extracted from the endpoint.
Optional service name string to sign the request with IAM credentials.
Holds the device specific information along with it's id and name.
The AWSAuthUser object contains username and userId from the idToken.
Input type for configureAutoTrack.
Input type for identifyUser.
Options to be passed to the API.
A User ID associated to the current device.
Additional information about the user and their device.
Base type for service options.
Name of the REST API configured in Amplify singleton.
Options to overwrite the REST API call behavior.
Path of the REST API.
Additional data that may be returned from Auth APIs.
Data describing the dispatch of a confirmation code.
Constructs a confirmSignIn input.
Constructs a confirmSignUp input.
Constructs a deleteUserAttributes input.
Denotes the medium over which a confirmation code was sent.
The AuthDevice object contains id and name of the device.
Constructs a forgetDevice input.
Data encapsulating the next step in the Sign Up process
The parameters for constructing a Resend Sign Up code input.
Denotes the next step in the Reset Password process.
Constructs a sendUserAttributeVerificationCode request.
Base type for service options.
On iOS devices, setting this to true requests that the browser not share cookies or other browsing data between the authentication session and the user’s normal browser session. This will bypass the permissions dialog that is displayed your user during sign-in and sign-out but also prevents reuse of existing sessions from the user's browser, requiring them to re-enter their credentials even if they are already externally logged in on their browser.
On all other platforms, this flag is ignored.
The parameters for constructing a Sign Up input.
The optional parameters for the Sign Up process.
Denotes the next step in the Update User Attribute process.
Constructs a updatePassword input.
Constructs a updateUserAttributes input.
Constructs a updateUserAttributes input.
The interface of a user attribute.
A user attribute key type consisting of standard OIDC claims or custom attributes.
Key/value pairs describing a user attributes.
Constructs a VerifyTOTPSetup input.
refCount tracks how many consumers have set state for a particular API to avoid it being cleared before all
consumers are done using it.
Category -> Action -> Custom State
Arbitrary key/value pairs that may be passed as part of certain Cognito requests
Holds data describing the dispatch of a confirmation code.
Holds the sign in details of the user.
Whether to use accelerate endpoint.
Compatible type for S3 streaming body exposed via Amplify public interfaces, like GetObjectCommandOutput exposed via download API. It's also compatible with the custom transfer handler interface HttpResponse.body.
Input type for Pinpoint configureAutoTrack API.
Input type for Cognito confirmResetPassword API.
Options specific to Cognito Confirm Reset Password.
Input type for Cognito confirmSignIn API.
Options specific to Cognito Confirm Sign In.
Output type for Cognito confirmSignIn API.
Auth step requires user to respond to a custom challenge.
Auth step requires user to change their password with any required attributes.
Auth step requires user to use SMS as multifactor authentication by retrieving a code sent to cellphone.
Auth step requires user to use TOTP as multifactor authentication by retriving an OTP code from authenticator app.
Input type for Cognito confirmSignUp API.
Output type for Cognito confirmSignUp API.
Auth step requires to confirm user's sign-up.
Try calling confirmSignUp.
Input type for Cognito confirmUserAttribute API.
Auth step requires user to select an mfa option (SMS | TOTP) to continue with the sign-in flow.
Auth step requires user to set up TOTP as multifactor authentication by associating an authenticator app and retrieving an OTP code.
Expiration in days
Input type for S3 copy API.
Output type for S3 copy API.
Cognito custom attribute type
Input type for Cognito deleteUserAttributes API.
Input type for Pinpoint dispatchEvent API.
Type representing a plain JavaScript object that can be serialized to JSON.
The sign-in process is complete.
No further action is needed.
Input type for S3 downloadData API.
Input options type for S3 downloadData API.
Output type for S3 downloadData API.
Basic option type for endpoint resolvers. It contains region only.
parse errors from given response. If no error code is found, return undefined. This function is protocol-specific (e.g. JSON, XML, etc.)
Output type for Cognito fetchDevices API.
Output type for Cognito fetchUserAttributes API.
Replaces all list result types in a query result with types to exclude nulls and undefined from list member unions.
If empty members are present, there will also be errors present, and the response will instead be thrown.
Input type for Cognito forgetDevice API.
Nominal type for branding generated graphql mutation operation strings with input and output types.
E.g.,
export const createWidget = `...` as GeneratedQuery<
CreateWidgetMutationVariables,
CreateWidgetMutation
>;
This allows graphql() to extract InputType and OutputType to correctly
assign types to the variables and result objects.
Nominal type for branding generated graphql query operation strings with input and output types.
E.g.,
export const getWidget = `...` as GeneratedQuery<
GetWidgetQueryVariables,
GetWidgetQuery
>;
This allows graphql() to extract InputType and OutputType to correctly
assign types to the variables and result objects.
Nominal type for branding generated graphql mutation operation strings with input and output types.
E.g.,
export const createWidget = `...` as GeneratedMutation<
CreateWidgetMutationVariables,
CreateWidgetMutation
>;
This allows graphql() to extract InputType and OutputType to correctly
assign types to the variables and result objects.
Output type for Cognito getCurrentUser API.
Input type for S3 getProperties API.
Input options type for S3 getProperties API.
Output type for S3 getProperties API.
Input type for S3 getUrl API.
Input options type for S3 getUrl API.
Output type for S3 getUrl API.
GraphQLSource or string, the type of the parameter for calling graphql.parse
The expected return type with respect to the given FALLBACK_TYPE
and TYPED_GQL_STRING.
Accepts a code generated model type and returns a supertype that can accept return values from the relevant graphql operations.
For example:
import { GraphQLReturnType } from 'aws-amplify/api';
import { MyModel } from './API';
import { getMyModel } from './graphql/queries';
const [item, setItem] = useState<GraphQLReturnType<MyModel>>();
setItem(await client.graphql({ query: getMyModel }).data.getMyModel!)
Trying to assign the result of a getMyModel operation directly to a
MyModel variables won't necessarily work, because normally-required related
models might not be part of the selection set.
This util simply makes related model properties optional recursively.
The expected type for variables in a V6 graphql() operation with
respect to the given FALLBACK_TYPES and TYPED_GQL_STRING.
The shape of messages passed to next() from a graphql subscription. E.g.,
const sub = client.graphql({
query: onCreateWidget,
}).subscribe({
//
// |-- You are here
// v
next(message: GraphqlSubscriptionMessage<OnCreateWidgetSubscription>) {
handle(message.value); // <-- type OnCreateWidgetSubscription
}
})
The return value from a graphql({query}) call when query is a subscription.
// |-- You are here
// v
const subResult: GraphqlSubscriptionResult<T> = client.graphql({
query: onCreateWidget
});
const sub = subResult.subscribe({
//
// |-- You are here
// v
next(message: GraphqlSubscriptionMessage<OnCreateWidgetSubscription>) {
handle(message.value); // <-- type OnCreateWidgetSubscription
}
})
Use basic Record interface to workaround fetch Header class not available in Node.js
The header names must be lowercased.
TODO: use LowerCase
Input type for Pinpoint identifyUser API. Input type for Pinpoint identifyUser API.
Options specific to Pinpoint identityUser. Options specific to Pinpoint identityUser. Options specific to Pinpoint identityUser.
Input type for identifyUser.
Options to be passed to the API.
A User ID associated to the current device.
Additional information about the user and their device.
Base type for service options.
Type to infer the option type of a transfer handler type.
Input type to invoke REST POST API from GraphQl client.
The abort controller to cancel the in-flight POST request.
Required if you want to make the internal post request cancellable. To make the internal post cancellable, you
must also call updateRequestToBeCancellable() with the promise from internal post call and the abort
controller.
Convert types
Completely internal to BackgroundProcessManager, and describes the structure of
an entry in the jobs registry.
An object provided by the caller that can be used to identify the description
of the job, which can otherwise be unclear from the promise and
terminate function. The description can be a string. (May be extended
later to also support object refs.)
Useful for troubleshooting why a manager is waiting for long periods of time
on close().
The underlying promise provided by the job function to wait for.
Request the termination of the job.
JSON type
JSON Object type
Input type for S3 list API. Lists all bucket objects.
Input options type for S3 list API.
Output type for S3 list API. Lists all bucket objects.
Lists bucket objects with pagination.
Lists all bucket objects.
type for S3 list item.
Input type for S3 list API. Lists bucket objects with pagination.
Input options type for S3 list API.
Output type for S3 list API. Lists bucket objects with pagination.
Cognito supported MFAPreference values that may be passed as part of the UpdateMFAPreferenceRequest.
Type to intersect multiple types if they have no conflict keys.
A slimmed down version of the AWS SDK v3 middleware, only handling tasks after Serde.
The context object to store states across the middleware chain.
The number of times the request has been attempted. This is set by retry middleware
A slimmed down version of the AWS SDK v3 middleware handler, only handling instantiated requests
Constructs a model and records it with its metadata in a weakset. Allows for the separate storage of core model fields and Amplify/DataStore metadata fields that the customer app does not want exposed.
A function that accepts a ModelPrecicate
This is used as predicates in DataStore.save(), DataStore.delete(), and
DataStore sync expressions.
DataStore.save(record, model => model.field.eq('some value'))Logical operators are supported. But, condtiions are related records are NOT supported. E.g.,
DataStore.delete(record, model => model.or(m => [
m.field.eq('whatever'),
m.field.eq('whatever else')
]))
Returns an updated response type to always return a value.
Input type for NotifyMessageInteraction API.
Input type for LexV2 onComplete API. Input type for LexV1 onComplete API.
Input type for OnMessageActionTaken API.
Output type for OnMessageActionTaken API.
Input type for OnMessageDismissed API.
Output type for OnMessageDismissed API.
Input type for OnMessageDisplayed API.
Output type for OnMessageDisplayed API.
Input type for OnMessageReceived API.
Output type for OnMessageReceived API.
Type representing an operation that can be canceled.
Type to convert a middleware option type to a middleware type with the given option type.
Describes a paged list result from AppSync, which can either live at the top query or property (e.g., related model) level.
Options to be passed to the API.
A User ID associated to the current device.
Additional information about the user and their device.
Base type for service options.
Input type for Pinpoint record API.
A function that accepts a RecursiveModelPrecicate
This is used in DataStore.query(), DataStore.observe(), and
DataStore.observeQuery() as the second argument. E.g.,
DataStore.query(MyModel, model => model.field.eq('some value'))More complex queries should also be supported. E.g.,
DataStore.query(MyModel, model => model.and(m => [
m.relatedEntity.or(relative => [
relative.relativeField.eq('whatever'),
relative.relativeField.eq('whatever else')
]),
m.myModelField.ne('something')
]))
Input type for S3 remove API.
Input options type for S3 getProperties API.
Output type for S3 remove API.
Input type for Cognito resendSignUpCode API.
Options specific to Cognito Resend Sign Up code.
Output type for Cognito resendSignUpCode API.
Input type for Cognito resetPassword API.
Options specific to Cognito Reset Password.
Output type for Cognito resetPassword API.
Auth step requires user to change their password.
Try calling resetPassword.
Internal only type for S3 API handlers' config parameter.
Reduce the API surface of Fetch API's Body mixin to only the methods we need. In React Native, body.arrayBuffer() is not supported. body.formData() is not supported for now.
Option controls whether or not cross-site Access-Control requests should be made using credentials
such as cookies, authorization headers or TLS client certificates. It has no effect on same-origin requests.
If set to true, the request will include credentials such as cookies, authorization headers, TLS
client certificates, and so on. Moreover the response cookies will also be set.
If set to false, the cross-site request will not include credentials, and the response cookies from a different
domain will be ignored.
Options for endpoint resolver.
Explicitly defined fields plus implied fields. (E.g., foreign keys.)
Explicitly defined fields.
Input type for LexV2 send API. Input type for LexV1 send API.
Output type for LexV2 send API. Output type for LexV1 send API.
Input type for Cognito sendUserAttributeVerificationCode API.
Options specific to a Cognito Update User Attributes request.
Output type for Cognito sendUserAttributeVerificationCode API.
Input type for Pinpoint SetConflictHandler API.
Output type for Cognito setUpTOTP API.
Input type for Cognito signIn API.
Options specific to Cognito Sign In.
Output type for Cognito signIn API.
Input type for Cognito signInWithCustomAuth API.
Output type for Cognito signInWithCustomAuth API.
Input type for Cognito signInWithCustomSRPAuth API.
Output type for Cognito signInWithCustomSRPAuth API.
Input type for Cognito signInWithRedirect API.
Input type for Cognito signInWithSRP API.
Output type for Cognito signInWithSRP API.
Input type for Cognito signInWithUserPasswordInput API.
Output type for Cognito signInWithUserPassword API.
Input type for Cognito signOut API.
Input type for Cognito signUp API.
Options specific to Cognito Sign Up.
Output type for Cognito signUp API.
expiresAt is date in which generated URL expires.
presigned URL of the given object.
An entity tag (ETag) is an opaque identifier assigned by a web server to a specific version of a resource found at a URL.
Key of the object
Creation date of the object.
The user-defined metadata for the object uploaded to S3.
Size of the body in bytes.
The data payload type for upload operation.
Transfer-related options type for S3 downloadData, uploadData APIs.
Callback function tracking the upload/download progress.
Cancel an ongoing transfer(upload/download) task. This will reject the result promise with an AbortError by
default. You can use isCancelError to check if the error is caused by cancellation.
Pause an ongoing transfer(upload/download) task. This method does not support the following scenarios:
Promise that resolves when the transfer task is completed. The promise will be rejected if the task is canceled.
Resume a paused transfer(upload/download) task. This method does not support the following scenarios:
Current state of the transfer task.
Result type for graphql() operations that don't include any specific
type information. The result could be either a Promise or Subscription.
Invoking code should either cast the result or use ? and ! operators to
navigate the result objects.
Input type for Cognito updateMFAPreference API.
Input type for Cognito updatePassword API.
Input type for Cognito updateUserAttribute API.
Options specific to Cognito Update User Attribute.
Output type for Cognito updateUserAttribute API.
Input type for Cognito updateUserAttributes API.
Options specific to Cognito Update User Attributes.
Output type for Cognito updateUserAttributes API.
Input type for S3 uploadData API.
Output type for S3 uploadData API.
The user attribute types available for Cognito.
One or more name-value pairs containing the validation data in the request to register a user.
Verifiable user attribute types available for Cognito.
Input type for Cognito verifyTOTPSetup API.
Options specific to Cognito Verify TOTP Setup.
Recursively looks through a result type and removes nulls and
and undefined from PagedList types.
Although a graphql response might contain empty values in an array, this will only be the case when we also have errors, which will then be thrown.
The REST endpoints generated by API Gateway
The Amplify utility is used to configure the library.
Erases all AsyncStorage for all clients, libraries, etc. You probably
don't want to call this; use removeItem or multiRemove to clear only
your app's keys.
See https://react-native-async-storage.github.io/async-storage/docs/api#clear
Flushes any pending requests using a single batch call to get the data.
See https://react-native-async-storage.github.io/async-storage/docs/api#flushgetrequests
Gets all keys known to your app; for all callers, libraries, etc.
See https://react-native-async-storage.github.io/async-storage/docs/api#getallkeys
Fetches an item for a key and invokes a callback upon completion.
See https://react-native-async-storage.github.io/async-storage/docs/api#getitem
Merges an existing key value with an input value, assuming both values
are stringified JSON.
See https://react-native-async-storage.github.io/async-storage/docs/api#mergeitem
This allows you to batch the fetching of items given an array of key
inputs. Your callback will be invoked with an array of corresponding
key-value pairs found.
See https://react-native-async-storage.github.io/async-storage/docs/api#multiget
Batch operation to merge in existing and new values for a given set of keys. This assumes that the values are stringified JSON.
See https://react-native-async-storage.github.io/async-storage/docs/api#multimerge
Call this to batch the deletion of all keys in the keys array.
See https://react-native-async-storage.github.io/async-storage/docs/api#multiremove
Use this as a batch operation for storing multiple key-value pairs. When the operation completes you'll get a single callback with any errors.
See https://react-native-async-storage.github.io/async-storage/docs/api#multiset
Removes an item for a key and invokes a callback upon completion.
See https://react-native-async-storage.github.io/async-storage/docs/api#removeitem
Sets the value for a key and invokes a callback upon completion.
See https://react-native-async-storage.github.io/async-storage/docs/api#setitem
Time in milleseconds to wait for GQL_CONNECTION_INIT message Time in milleseconds to wait for GQL_CONNECTION_INIT message
Default Time in milleseconds to alert for missed GQL_CONNECTION_KEEP_ALIVE message Default Time in milleseconds to alert for missed GQL_CONNECTION_KEEP_ALIVE message
Default Time in milleseconds to wait for GQL_CONNECTION_KEEP_ALIVE message Default Time in milleseconds to wait for GQL_CONNECTION_KEEP_ALIVE message
Used by the Async Storage Adapter to concatenate key values
for a record. For instance, if a model has the following keys:
customId: ID! @primaryKey(sortKeyFields: ["createdAt"]),
we concatenate the customId and createdAt as:
12-234-5#2022-09-28T00:00:00.000Z
Date & time utility functions to abstract the aws-sdk away from users.
(v2 => v3 modularization is a breaking change)
Tests if a hex string has it most significant bit set (case-insensitive regex)
Used for generating spinal-cased index name from an array of
key field names.
E.g. for keys [id, title] => 'id-title'
The point after which queries composed of multiple simple OR conditions should scan-and-filter instead of individual queries for each condition.
At some point, this should be configurable and/or dynamic based on table size and possibly even on observed average seek latency. For now, it's based on an manual "binary search" for the breakpoint as measured in the unit test suite. This isn't necessarily optimal. But, it's at least derived empirically, rather than theoretically and without any verification!
REMEMBER! If you run more realistic benchmarks and update this value, update this comment so the validity and accuracy of future query tuning exercises can be compared to the methods used to derive the current value. E.g.,
etc...
Default delay time in milleseconds between when reconnect is triggered vs when it is attempted Default delay time in milleseconds between when reconnect is triggered vs when it is attempted
Default interval time in milleseconds between when reconnect is re-attempted Default interval time in milleseconds between when reconnect is re-attempted
The service name used to sign requests if the API requires authentication. The service name used to sign requests if the API requires authentication. The service name used to sign requests if the API requires authentication. The service name used to sign requests if the API requires authentication. The service name used to sign requests if the API requires authentication.
Time in milleseconds to wait for GQL_START_ACK message Time in milleseconds to wait for GQL_START_ACK message
Each identifier type is represented using nominal types, see: https://basarat.gitbook.io/typescript/main-1/nominaltyping
Tells us which data source a model is attached to (lazy loads from).
If Deatched, the model's lazy properties will only ever return properties
from memory provided at construction time.
Signs a user in automatically after finishing the sign-up process.
This API will automatically sign a user in if the autoSignIn flow has been completed in the following cases:
Messaging tab and enable link mode inside the Verification message option.
Finally you need to define the signUpVerificationMethod in your Auth config.This weak map provides functionality to cancel a request given the promise containing the post request.
cancel(promise) to cancel the request.cancel(promise) is called, then the corresponding abort controller is retrieved from the map below.isCancelError(error).Cognito specific implmentation of the CredentialsProvider interface that manages setting and getting of AWS Credentials.
A Cognito Identity-specific transfer handler that does NOT sign requests, and disables caching.
A Cognito Identity-specific transfer handler that does NOT sign requests, and disables caching. A Cognito Identity-specific transfer handler that does NOT sign requests, and disables caching.
The valid comparison operators that can be used as keys in a predicate comparison object.
Confirms a new user account.
The ConfirmSignUpInput object.
ConfirmSignUpOutput
Deletes a user from the user pool while authenticated.
Deletes user attributes.
The DeleteUserAttributesInput object
Disables the Analytics category.
Enables the Analytics category to permit the transmission of events.
These Records hold cached event buffers and AWS clients. The hash key is determined by the region and session, consisting of a combined value comprising [region, sessionToken, identityId]. These Records hold cached event buffers and AWS clients. The hash key is determined by the region and session, consisting of a combined value comprising [region, sessionToken, identityId]. These Records hold cached event buffers and AWS clients. The hash key is determined by the region and session, consisting of a combined value comprising [region, sessionToken, identityId].
Only one active session should exist at any given moment. When a new session is initiated, the previous ones should be released.
Only one active session should exist at any given moment. When a new session is initiated, the previous ones should be released.
Only one active session should exist at any given moment. When a new session is initiated, the previous ones should be released.
Forget a remembered device while authenticated.
The ForgetDeviceInput object.
Small utility function to generate a monotonically increasing ID. Used by GroupCondition to help keep track of which group is doing what, when, and where during troubleshooting.
The valid logical grouping keys for a predicate group.
Records the patches (as if against an empty object) used to initialize an instance of a Model. This can be used for determining which fields to send to the cloud durnig a CREATE mutation.
Collection of instantiated models to allow storage of metadata apart from the model visible to the consuming app -- in case the app doesn't have metadata fields (_version, _deleted, etc.) exposed on the model itself.
NOTE!
This is used only by DataStore.
This can probably be pruned and/or removed. Just leaving it as much of the same state as possible for V6 to reduce number of potentially impactful changes to DataStore.
Maps a model to its related models for memoization/immutability.
Stores data for crafting the correct update mutation input for a model.
Patch[] - array of changed fields and metadata.PersistentModel - the source model, used for diffing object-type fields.A map from keys (exposed to customers) to the internal predicate data structures invoking code should not muck with.
S3 transfer handler for browser and React Native based on XHR. On top of basic transfer handler, it also supports x-amz-content-sha256 header, and request&response process tracking. S3 transfer handler for node based on Node-fetch. On top of basic transfer handler, it also supports x-amz-content-sha256 header. However, it does not support request&response process tracking like browser.
Creates a user
The SignUpInput object
SignUpOutput
An aysnc implementation of Array.every(). Returns as soon as a non-match is found.
The items to check.
The async matcher function, expected to
return Promisetrue for a matching item, false otherwise.
A Promise<boolean>, true if every item matches; false otherwise.
An async implementation of Array.filter(). Returns after all items have been filtered.
TODO: Return AsyncIterable.
The items to filter.
The async matcher function, expected to
return Promisetrue for a matching item, false otherwise.
A Promise<T> of matching items.
An aysnc implementation of Array.some(). Returns as soon as a match is found.
The items to check.
The async matcher function, expected to
return Promisetrue for a matching item, false otherwise.
A Promise<boolean>, true if "some" items match; false otherwise.
Registers a model instance against a data source (DataStore, API, or Detached/None).
The API option is demonstrative. Lazy loading against API is not yet implemented.
A model instance or array of instances
A ModelAttachment data source
passes the result back through after attachment
Converts blob to array buffer
Internal-only method to create a new RestApiError from a service error.
Creates a predicate without any conditions that can be passed to customer code to have conditions added to it.
For example, in this query:
await DataStore.query(
Model,
item => item.field.eq('value')
);
buildSeedPredicate(Model) is used to create item, which is passed to the
predicate function, which in turn uses that "seed" predicate (item) to build
a predicate tree.
The model the predicate will query.
If the given (operator, operand) indicate the need for a special NULL comparison,
that WHERE clause condition will be returned. If not special NULL handling is
needed, null will be returned, and the caller should construct the WHERE
clause component using the normal operator map(s) and parameterization.
"beginsWith" | "contains" | "notContains" | "between" | "eq" | "ne" | "le" | "lt" | "ge" | "gt"
any
(string | null) The WHERE clause component or null if N/A.
Internal-only method to create a new StorageError from a service error.
Calculate the total size of the data to be uploaded. The total size is not required for multipart upload, as it's only used in progress report.
Writes an endpoint id to a long-lived cache.
Cancels an inflight request. Only applicable for graphql queries and mutations
Organizes blocks from Rekognition API to each of the categories and and structures their data accordingly.
Organizes blocks from Textract API to each of the categories and and structures their data accordingly.
Throws an exception if the schema is using a codegen version that is not supported.
Set the supported version by setting majorVersion and minorVersion This functions similar to ^ version range. The tested codegenVersion major version must exactly match the set majorVersion The tested codegenVersion minor version must be gt or equal to the set minorVersion Example: For a min supported version of 5.4.0 set majorVersion = 5 and minorVersion = 4
This regex will not work when setting a supported range with minor version of 2 or more digits. i.e. minorVersion = 10 will not work The regex will work for testing a codegenVersion with multi digit minor versions as long as the minimum minorVersion is single digit. i.e. codegenVersion = 5.30.1, majorVersion = 5, minorVersion = 4 PASSES
schema codegenVersion
Throws an exception if the schema has not been initialized
by initSchema().
To be called before trying to access schema.
Currently this only needs to be called in start() and clear() because
all other functions will call start first.
Queries the DataStore metadata tables to see if they are the expected version. If not, clobbers the whole DB. If so, leaves them alone. Otherwise, simply writes the schema version.
SIDE EFFECT:
Storage adapter containing the metadata.
The expected schema version.
Clear locally cached messages.
A promise that will resolve when the operation is complete.
Provides a Cognito identityId
The AuthTokens received after SignIn
string
Compose a transfer handler with a core transfer handler and a list of middleware.
Core transfer handler
List of middleware
A transfer handler whose option type is the union of the core transfer handler's option type and the middleware's option type.
Configures automatic event tracking for Pinpoint. This API will automatically transmit an analytic event when
configured events are detected within your application. This can include: DOM element events (via the event
tracker), session events (via the session tracker), and page view events (via the pageView tracker).
Confirms the new password and verification code to reset the password.
The ConfirmResetPasswordInput object.
Continues or completes the sign in process when required by the initial call to signIn.
The ConfirmSignInInput object
ConfirmSignInOutput
Confirms a user attribute with the confirmation code.
The ConfirmUserAttributeInput object
A middleware that adds the x-amz-content-sha256 header to the request if it is not already present. It's required for S3 requests in browsers where the request body is sent in 1 chunk.
Convert xhr.getAllResponseHeaders() string to a Record<string, string>. Note that modern browser already returns header names in lowercase.
string of headers returned from xhr.getAllResponseHeaders()
selective sync predicate group
the total number of OR'd predicates in the filter group
Creates a instance of CognitoAWSCredentialsAndIdentityIdProvider using
the provided keyValueStorage.
The Auth config that the credentials provider needs to function.
An object that implements the KeyValueStorageInterface.
An instance of CognitoAWSCredentialsAndIdentityIdProvider.
Creates an Amplify server context.
The Amplify resource config.
The Amplify library options.
The Amplify server context spec.
Create a cancellable operation conforming to the internal POST API interface.
Create a cancellable operation conforming to the external REST API interface.
Creates a Key Value storage interface using the cookieStorageAdapter as the
underlying storage.
An implementation of the Adapter in CookieStorage.
An object that implements KeyValueStorageInterface.
Creates the runWithAmplifyServerContext function to run Amplify server side APIs in an isolated request context.
An object that contains the runWithAmplifyServerContext function.
Creates an object that implements TokenProvider.
The Auth config that the credentials provider needs to function.
An object that implements the KeyValueStorageInterface.
An object that implements TokenProvider.
Deserializes a string to a boolean. Returns undefined if input is undefined. Returns true if input is 'true', otherwise false.
Deserializes a string to a number. Returns undefined if input is undefined.
Deserializes a string to a Date. Returns undefined if input is undefined. It supports epoch timestamp; rfc3339(cannot have a UTC, fractional precision supported); rfc7231(section 7.1.1.1)
Destroys an Amplify server context.
The context spec used to destroy the Amplify server context.
A Cognito Identity-specific middleware that disables caching for all requests. A Cognito Identity-specific middleware that disables caching for all requests. A Cognito Identity-specific middleware that disables caching for all requests.
A Cognito Identity-specific middleware that disables caching for all requests. A Cognito Identity-specific middleware that disables caching for all requests. A Cognito Identity-specific middleware that disables caching for all requests.
A Cognito Identity-specific middleware that disables caching for all requests. A Cognito Identity-specific middleware that disables caching for all requests. A Cognito Identity-specific middleware that disables caching for all requests.
Triggers an In-App message to be displayed. Use this after your campaigns have been synced to the device using syncMessages. Based on the messages synced and the event passed to this API, it triggers the display of the In-App message that meets the criteria.
A promise that will resolve when the operation is complete.
Download S3 object data to memory
The DownloadDataInput object.
A cancelable task exposing result promise from result property.
set of field names used with dynamic auth modes configured for the provided model definition
Function that makes sure the deserializer receives non-empty array.
The endpoint resolver function that returns the endpoint URL for a given region. The endpoint resolver function that returns the endpoint URL for a given region. The endpoint resolver function that returns the endpoint URL for a given region. The endpoint resolver function that returns the endpoint URL for a given region. The endpoint resolver function that returns the endpoint URL for a given region, and input parameters.
The endpoint resolver function that returns the endpoint URL for a given region. The endpoint resolver function that returns the endpoint URL for a given region. The endpoint resolver function that returns the endpoint URL for a given region. The endpoint resolver function that returns the endpoint URL for a given region. The endpoint resolver function that returns the endpoint URL for a given region, and input parameters.
The endpoint resolver function that returns the endpoint URL for a given region. The endpoint resolver function that returns the endpoint URL for a given region. The endpoint resolver function that returns the endpoint URL for a given region. The endpoint resolver function that returns the endpoint URL for a given region. The endpoint resolver function that returns the endpoint URL for a given region, and input parameters.
The endpoint resolver function that returns the endpoint URL for a given region. The endpoint resolver function that returns the endpoint URL for a given region. The endpoint resolver function that returns the endpoint URL for a given region. The endpoint resolver function that returns the endpoint URL for a given region. The endpoint resolver function that returns the endpoint URL for a given region, and input parameters.
The endpoint resolver function that returns the endpoint URL for a given region. The endpoint resolver function that returns the endpoint URL for a given region. The endpoint resolver function that returns the endpoint URL for a given region. The endpoint resolver function that returns the endpoint URL for a given region. The endpoint resolver function that returns the endpoint URL for a given region, and input parameters.
Wraps encodeURIComponent to encode additional characters to fully adhere to RFC 3986.
URI string to encode
RFC 3986 encoded string
Backwards-compatability for schema generated prior to custom primary key support:
the single field targetName has been replaced with an array of targetNames.
targetName and targetNames are exclusive (will never exist on the same schema)
array of targetNames, or undefined
Fetches devices that have been remembered using rememberDevice for the currently authenticated user.
FetchDevicesOutput
Fetches the preferred MFA setting and enabled MFA settings for the user.
FetchMFAPreferenceOutput
selective sync predicate group
set of distinct field names in the filter group
Find the cached multipart upload id and get the parts that have been uploaded with ListParts API. If the cached upload is expired(1 hour), return null.
Flushes all buffered Pinpoint events to the service. Flushes all buffered Kinesis events to the service. Flushes all buffered Kinesis events to the service. Flushes all buffered Personalize events to the service.
Flushes all buffered Pinpoint events to the service. Flushes all buffered Kinesis events to the service. Flushes all buffered Kinesis events to the service. Flushes all buffered Personalize events to the service.
Flushes all buffered Pinpoint events to the service. Flushes all buffered Kinesis events to the service. Flushes all buffered Kinesis events to the service. Flushes all buffered Personalize events to the service.
Flushes all buffered Pinpoint events to the service. Flushes all buffered Kinesis events to the service. Flushes all buffered Kinesis events to the service. Flushes all buffered Personalize events to the service.
Flushes all buffered Pinpoint events to the service. Flushes all buffered Kinesis events to the service. Flushes all buffered Kinesis events to the service. Flushes all buffered Personalize events to the service.
Desired length of the code verifier.
NOTE: According to the RFC 7636 A code verifier must be with a length >= 43 and <= 128.
An object that contains the generated codeVerifier and a method
toCodeChallenge to generate the code challenge from the codeVerifier
following the spec of RFC 7636.
Generates a random BigInteger.
a random value.
Generates an API client that can be used with both Pages Router and App Router
Returns an Amplify server context.
The context spec used to get the Amplify server context.
The Amplify server context.
Determines what source a model instance should lazy load from.
If the instace was never explicitly registered, it is detached by default.
A model instance
Returns a new AuthenticationHelper instance with randomly generated BigInteger seed
Cognito user pool name.
An AuthenticationHelper instance.
Returns the current badge count (the number next to your app's icon). This function is safe to call (but will be ignored) even when your React Native app is running on platforms where badges are not supported.
A promise that resolves to a number representing the current count displayed on the app badge.
Returns the current badge count (the number next to your app's icon). This function is safe to call (but will be ignored) even when your React Native app is running on platforms where badges are not supported.
A promise that resolves to a number representing the current count displayed on the app badge.
Returns the current badge count (the number next to your app's icon). This function is safe to call (but will be ignored) even when your React Native app is running on platforms where badges are not supported.
A promise that resolves to a number representing the current count displayed on the app badge.
return the byte size of the string
Converts a hexadecimal encoded string to a Uint8Array of bytes.
The hexadecimal encoded string
Converts a hexadecimal encoded string to a Uint8Array of bytes.
Returns a unique cache key for a particular category/appId combination.
Returns canonical headers.
Headers from the request.
Request headers that will be signed, and their values, separated by newline characters. Header names must use lowercase characters, must appear in alphabetical order, and must be followed by a colon (:). For the values, trim any leading or trailing spaces, convert sequential spaces to a single space, and separate the values for a multi-value header using commas.
Returns a canonical query string.
searchParams from the request url.
URL-encoded query string parameters, separated by ampersands (&). Percent-encode reserved characters, including the space character. Encode names and values separately. If there are empty parameters, append the equals sign to the parameter name before encoding. After encoding, sort the parameters alphabetically by key name. If there is no query string, use an empty string ("").
Returns a canonical request.
Whether to uri encode the path as part of canonical uri. It's used for S3 only where the pathname is already uri encoded, and the signing process is not expected to uri encode it again. Defaults to true.
String created by by concatenating the following strings, separated by newline characters:
Returns a canonical uri.
pathname from request url.
Whether to uri encode the path as part of canonical uri. It's used for S3 only where the pathname is already uri encoded, and the signing process is not expected to uri encode it again. Defaults to true.
URI-encoded version of the absolute path component URL (everything between the host and the question mark character (?) that starts the query string parameters). If the absolute path is empty, a forward slash character (/).
Track the progress from multiple concurrent uploads, and invoke the onProgress callback.
Returns the credential scope which restricts the resulting signature to the specified region and service.
Current date in the format 'YYYYMMDD'.
AWS region in which the service resides.
Service to which the signed request is being sent.
A string representing the credential scope with format 'YYYYMMDD/region/service/aws4_request'.
get current time
Get the AWS Services endpoint URL's DNS suffix for a given region. A typical AWS regional service endpoint URL will
follow this pattern: {endpointPrefix}.{region}.{dnsSuffix}. For example, the endpoint URL for Cognito Identity in
us-east-1 will be cognito-identity.us-east-1.amazonaws.com. Here the DnsSuffix is amazonaws.com.
The DNS suffix
Returns an endpoint id from cache or undefined if not found.
Returns expected date strings to be used in signing.
JavaScript Date object.
FormattedDates object containing the following:
Returns the hashed data a Uint8Array.
SourceData to be used as hashing key.
Hashable SourceData.
Uint8Array created from the data as input to a hash function.
Returns the hashed data as a hex string.
SourceData to be used as hashing key.
Hashable SourceData.
String using lowercase hexadecimal characters created from the data as input to a hash function.
Returns the hashed payload.
body (payload) from the request.
String created using the payload in the body of the HTTP request as input to a hash function. This string uses lowercase hexadecimal characters. If the payload is empty, return precalculated result of an empty hash.
Converts a Uint8Array of binary data to a hexadecimal encoded string.
The binary data to encode
Standard HKDF algorithm.
Input key material.
Salt value.
Context and application specific info.
Strong key material.
Returns the notification which launched your app from a terminated state. The launch notification is consumed by calls to this function and will yield a null result if:
null otherwise.Returns the notification which launched your app from a terminated state. The launch notification is consumed by calls to this function and will yield a null result if:
null otherwise.Returns the notification which launched your app from a terminated state. The launch notification is consumed by calls to this function and will yield a null result if:
null otherwise.Either a reference to window.localStorage or an in-memory storage as fallback
Explicitly defined fields plus implied fields. (E.g., foreign keys.)
Explicitly defined fields.
Create closure hiding the multipart upload implementation details and expose the upload job and control functions( onPause, onResume, onCancel).
This function is used to kick off the device management flow.
If an error is thrown while generating a hash device or calling the ConfirmDevice
client, then this API will ignore the error and return undefined. Otherwise the authentication
flow will not complete and the user won't be able to be signed in.
DeviceMetadata | undefined
Uses performance.now() if available, otherwise, uses Date.now() (e.g. react native without a polyfill)
The values returned by performance.now() always increase at a constant rate, independent of the system clock (which might be adjusted manually or skewed by software like NTP).
Otherwise, performance.timing.navigationStart + performance.now() will be approximately equal to Date.now()
See: https://developer.mozilla.org/en-US/docs/Web/API/Performance/now#Example
Returns an unambiguous, even-length hex string of the two's complement encoding of an integer.
It is compatible with the hex encoding of Java's BigInteger's toByteArray(), wich returns a byte array containing the two's-complement representation of a BigInteger. The array contains the minimum number of bytes required to represent the BigInteger, including at least one sign bit.
Examples showing how ambiguity is avoided by left padding with: "00" (for positive values where the most-significant-bit is set) "FF" (for negative values where the most-significant-bit is set)
padHex(bigInteger.fromInt(-236)) === "FF14" padHex(bigInteger.fromInt(20)) === "14"
padHex(bigInteger.fromInt(-200)) === "FF38" padHex(bigInteger.fromInt(56)) === "38"
padHex(bigInteger.fromInt(-20)) === "EC" padHex(bigInteger.fromInt(236)) === "00EC"
padHex(bigInteger.fromInt(-56)) === "C8" padHex(bigInteger.fromInt(200)) === "00C8"
Number to encode.
even-length hex string of the two's complement encoding.
Returns a string representing the current status of user permissions to display push notifications. The possible statuses are as follows:
'shouldRequest' - No permissions have been requested yet. It is idiomatic at this time to simply request for
permissions from the user.
'shouldExplainThenRequest' - It is recommended at this time to provide some context or rationale to the user
explaining why you want to send them push notifications before requesting for permissions.
'granted' - Permissions have been granted by the user. No further actions are needed and their app is ready to
display notifications.
'denied' - Permissions have been denied by the user. Further attempts to request permissions will no longer
trigger a permission dialog. Your app should now either degrade gracefully or prompt your user to grant the
permissions needed in their device settings.
a promise resolving to a string representing the current status of user selected notification permissions.
Returns a string representing the current status of user permissions to display push notifications. The possible statuses are as follows:
'shouldRequest' - No permissions have been requested yet. It is idiomatic at this time to simply request for
permissions from the user.
'shouldExplainThenRequest' - It is recommended at this time to provide some context or rationale to the user
explaining why you want to send them push notifications before requesting for permissions.
'granted' - Permissions have been granted by the user. No further actions are needed and their app is ready to
display notifications.
'denied' - Permissions have been denied by the user. Further attempts to request permissions will no longer
trigger a permission dialog. Your app should now either degrade gracefully or prompt your user to grant the
permissions needed in their device settings.
a promise resolving to a string representing the current status of user selected notification permissions.
Returns a string representing the current status of user permissions to display push notifications. The possible statuses are as follows:
'shouldRequest' - No permissions have been requested yet. It is idiomatic at this time to simply request for
permissions from the user.
'shouldExplainThenRequest' - It is recommended at this time to provide some context or rationale to the user
explaining why you want to send them push notifications before requesting for permissions.
'granted' - Permissions have been granted by the user. No further actions are needed and their app is ready to
display notifications.
'denied' - Permissions have been denied by the user. Further attempts to request permissions will no longer
trigger a permission dialog. Your app should now either degrade gracefully or prompt your user to grant the
permissions needed in their device settings.
a promise resolving to a string representing the current status of user selected notification permissions.
Get a presigned URL for the getObject API.
Returns a Uint8Array with a sequence of random nBytes
fixed-length sequence of random bytes
Helper function to generate a random string
a random value.
Get retry decider function
Function to load JavaScript error from HTTP response
Either a reference to window.sessionStorage or an in-memory storage as fallback
Calculates and returns an AWS API Signature. https://docs.aws.amazon.com/IAM/latest/UserGuide/create-signed-request.html
HttpRequest to be signed.
AWS API Signature to sign a request or url with.
Returns signed headers.
headers from the request.
List of headers included in canonical headers, separated by semicolons (;). This indicates which headers are part of the signing process. Header names must use lowercase characters and must appear in alphabetical order.
Returns a signing key to be used for signing requests.
AWS secret access key from credentials.
Current date in the format 'YYYYMMDD'.
AWS region in which the service resides.
Service to which the signed request is being sent.
Uint8Array calculated from its composite parts.
Extracts common values used for signing both requests and urls.
Common SigningValues used for signing.
Returns a Date that is corrected for clock skew.
The offset of the system clock in milliseconds.
Date representing the current time adjusted by the system clock offset.
Returns a string to be signed.
Current date in the format 'YYYYMMDDThhmmssZ'.
String representing the credential scope with format 'YYYYMMDD/region/service/aws4_request'.
Hashed canonical request.
A string created by by concatenating the following strings, separated by newline characters:
Determine what the managed timestamp field names are for the given model definition and return the mapping.
All timestamp fields are included in the mapping, regardless of whether the final field
names are the defaults or customized in the @model directive.
modelDefinition to inspect.
An object mapping createdAt and updatedAt to their field names.
Returns the current token.
Returns the difference between clock time and the current system time if clock is skewed.
Clock time in milliseconds.
Current system clock offset in milliseconds.
Get the cache key of a multipart upload. Data source cached by different: size, content type, bucket, access level, key. If the data source is a File instance, the upload is additionally indexed by file name and last modified time. So the library always created a new multipart upload if the file is modified.
Recursively parses object and populates value is node from "#text" key if it's available
Invokes graphql operations against a graphql service, providing correct input and output types if Amplify-generated graphql from a recent version of the CLI/codegen are used or correct typing is provided via the type argument.
Amplify-generated "branded" graphql queries will look similar to this:
//
// |-- branding
// v
export const getModel = `...` as GeneratedQuery<
GetModelQueryVariables,
GetModelQuery
>;
If this branding is not in your generated graphql, update to a newer version of
CLI/codegen and regenerate your graphql using amplify codegen.
import * as queries from './graphql/queries';
//
// |-- correctly typed graphql response containing a Widget
// v
const queryResult = await graphql({
query: queries.getWidget,
variables: {
id: "abc", // <-- type hinted/enforced
},
});
//
// |-- a correctly typed Widget
// v
const fetchedWidget = queryResult.data?.getWidget!;
To provide input types (variables) and result types:
type GetById_NameOnly = {
variables: {
id: string
},
result: Promise<{
data: { getWidget: { name: string } }
}>
}
//
// |-- type is GetById_NameOnly["result"]
// v
const result = graphql<GetById_NameOnly>({
query: "...",
variables: { id: "abc" } // <-- type of GetById_NameOnly["variables"]
});
To specify result types only, use a type that is not in the {variables, result} shape:
type MyResultType = Promise<{
data: {
getWidget: { name: string }
}
}>
//
// |-- type is MyResultType
// v
const result = graphql<MyResultType>({query: "..."});
Hex encoding strategy. Converts a word array to a hex string.
The word array.
The hex string.
Sends information about a user to Pinpoint. Sending user information allows you to associate a user to their user
profile and activities or actions in your application. Activity can be tracked across devices & platforms by using
the same userId.
Sends information about a user to Pinpoint. Sending user information allows you to associate a user to their user
profile and activities or actions in your application. Activity can be tracked across devices & platforms by using
the same userId.
Sends information about a user to Pinpoint. Sending user information allows you to associate a user to their user
profile and activities or actions in your application. Activity can be tracked across devices & platforms by using
the same userId.
A promise that will resolve when the operation is complete.
Sends information about a user to Pinpoint. Sending user information allows you to associate a user to their user
profile and activities or actions in your application. Activity can be tracked across devices & platforms by using
the same userId.
Sends information about a user to Pinpoint. Sending user information allows you to associate a user to their user
profile and activities or actions in your application. Activity can be tracked across devices & platforms by using
the same userId.
Sends information about a user to Pinpoint. Sending user information allows you to associate a user to their user
profile and activities or actions in your application. Activity can be tracked across devices & platforms by using
the same userId.
A promise that will resolve when the operation is complete.
Sends information about a user to Pinpoint. Sending user information allows you to associate a user to their user
profile and activities or actions in your application. Activity can be tracked across devices & platforms by using
the same userId.
Sends information about a user to Pinpoint. Sending user information allows you to associate a user to their user
profile and activities or actions in your application. Activity can be tracked across devices & platforms by using
the same userId.
Sends information about a user to Pinpoint. Sending user information allows you to associate a user to their user
profile and activities or actions in your application. Activity can be tracked across devices & platforms by using
the same userId.
A promise that will resolve when the operation is complete.
Sends information about a user to Pinpoint. Sending user information allows you to associate a user to their user
profile and activities or actions in your application. Activity can be tracked across devices & platforms by using
the same userId.
Sends information about a user to Pinpoint. Sending user information allows you to associate a user to their user
profile and activities or actions in your application. Activity can be tracked across devices & platforms by using
the same userId.
Sends information about a user to Pinpoint. Sending user information allows you to associate a user to their user
profile and activities or actions in your application. Activity can be tracked across devices & platforms by using
the same userId.
A promise that will resolve when the operation is complete.
Statelessly extracts the specified page from an array.
The source array to extract a page from.
A definition of the page to extract.
This items from records matching the pagination definition.
Sets initialization status to true. Sets initialization status to true.
Sets initialization status to true. Sets initialization status to true.
Initialize and set up in-app messaging category. This API needs to be called to enable other InAppMessaging APIs.
Attempts to apply type-aware, casted field values from a given init
object to the given draft.
The initialization object to extract field values from.
The definition describing the target object shape.
The draft to apply field values to.
Initialize and set up the push notification category. The category must be first initialized before all other functionalities become available.
Initialize and set up the push notification category. The category must be first initialized before all other functionalities become available.
Takes a key object from registerPredicateInternals() to fetch an internal
GroupCondition object, which can then be used to query storage or
test/match objects.
This indirection exists to hide GroupCondition from public interfaces, since
GroupCondition contains extra methods and properties that public callers
should not use.
A key object previously returned by registerPredicateInternals()
Returns the current status of the Analytics category.
Checks to see if an error thrown is from an api request cancellation
Any error
Given an error code, returns true if it is related to a clock skew error.
String representation of some error.
True if given error is present in CLOCK_SKEW_ERROR_CODES, false otherwise.
Checks if the provided date is within the skew window of 5 minutes.
Time to check for skew in milliseconds.
Offset to check clock against in milliseconds.
True if skewed. False otherwise.
Determines whether an object is a GraphQL style predicate comparison node, which must be an object containing a single "comparison operator" key, which then contains the operand or operands to compare against.
The object to test.
Determines whether a given string is DNS compliant per the rules outlined by S3. Length, capitaization, and leading dot restrictions are enforced by the DOMAIN_PATTERN regular expression.
Determines whether an object specifies no conditions and should match everything,
as would be the case with Predicates.ALL.
The object to test.
Determines whether an object is a GraphQL style predicate "group", which must be an object containing a single "group key", which then contains the child condition(s).
E.g.,
{ and: [ ... ] }
{ not: { ... } }
The object to test.
Returns the initialization status of In-App Messaging. Returns the initialization status of push notifications.
Returns the initialization status of In-App Messaging. Returns the initialization status of push notifications.
check if passed value is an integer
Whether the browser's implementation of IndexedDB breaks on array lookups against composite indexes whose keypath contains a single column.
E.g., Whether store.createIndex(indexName, ['id']) followed by
store.index(indexName).get([1]) will ever return records.
In all known, modern Safari browsers as of Q4 2022, the query against an index like
this will always return undefined. So, the index needs to be created as a scalar.
A light check to determine whether an object is a valid GraphQL Condition AST.
The object to test.
Determines whether the given object is a Model Constructor that DataStore can safely use to construct objects and discover related metadata.
The object to test.
Allocates a new buffer containing the given {str}.
String to store in buffer.
encoding to use, optional. Default is 'utf8'
Allocates a new buffer of {size} octets.
count of octets to allocate.
Allocates a new buffer containing the given {array} of octets.
The octets to store.
Produces a Buffer backed by the same allocated memory as the given {ArrayBuffer}.
The ArrayBuffer with which to share memory.
Allocates a new buffer containing the given {array} of octets.
The octets to store.
Copies the passed {buffer} data onto a new {Buffer} instance.
The buffer to copy.
This is the number of bytes used to determine the size of pre-allocated, internal Buffer instances used for pooling. This value may be modified.
Allocates a new buffer of {size} octets.
count of octets to allocate.
if specified, buffer will be initialized by calling buf.fill(fill). If parameter is omitted, buffer will be filled with zeros.
encoding used for call to buf.fill while initalizing
Allocates a new buffer of {size} octets, leaving memory not initialized, so the contents of the newly created Buffer are unknown and may contain sensitive data.
count of octets to allocate
Allocates a new non-pooled buffer of {size} octets, leaving memory not initialized, so the contents of the newly created Buffer are unknown and may contain sensitive data.
count of octets to allocate
Gives the actual byte length of a string. encoding defaults to 'utf8'. This is not the same as String.prototype.length since that returns the number of characters in a string.
string to test. (TypedArray is also allowed, but it is only available starting ES2017)
encoding used to evaluate (defaults to 'utf8')
Returns a buffer which is the result of concatenating all the buffers in the list together.
If the list has no items, or if the totalLength is 0, then it returns a zero-length buffer. If the list has exactly one item, then the first item of the list is returned. If the list has more than one item, then a new Buffer is created.
An array of Buffer objects to concatenate
Total length of the buffers when concatenated. If totalLength is not provided, it is read from the buffers in the list. However, this adds an additional loop to the function, so it is faster to provide the length explicitly.
When passed a reference to the .buffer property of a TypedArray instance, the newly created Buffer will share the same allocated memory as the TypedArray. The optional {byteOffset} and {length} arguments specify a memory range within the {arrayBuffer} that will be shared by the Buffer.
The .buffer property of a TypedArray or a new ArrayBuffer()
Creates a new Buffer using the passed {data}
data to create a new Buffer
Creates a new Buffer containing the given JavaScript string {str}. If provided, the {encoding} parameter identifies the character encoding. If not provided, {encoding} defaults to 'utf8'.
Returns true if {obj} is a Buffer
object to test.
Returns true if {encoding} is a valid encoding argument. Valid string encodings in Node 0.12: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex'
string to test.
Load the in-progress multipart upload from local storage or async storage(RN) if it exists, or create a new multipart upload.
Changes object keys to camel case. If optional parameter keys is given, then we extract only the
keys specified in keys.
Given an array of object, call makeCamelCase(...) on each option.
Maps an object to a new object using the provided instructions. The instructions are a map of the returning mapped object's property names to a single instruction of how to map the value from the original object to the new object. There are two types of instructions:
A string representing the property name of the original object to map to the new object. The value mapped from the original object will be the same as the value in the new object, and it can ONLY be string.
An array of two elements. The first element is the property name of the original object to map to the new object. The second element is a function that takes the value from the original object and returns the value to be mapped to the new object. The function can return any type.
Example:
const input = {
Foo: 'foo',
BarList: [{value: 'bar1'}, {value: 'bar2'}]
}
const output = map(input, {
someFoo: 'Foo',
bar: ['BarList', (barList) => barList.map(bar => bar.value)]
baz: 'Baz' // Baz does not exist in input, so it will not be in the output.
});
// output = { someFoo: 'foo', bar: ['bar1', 'bar2'] }
The object containing the data to compose mapped object.
The instructions mapping the object values to the new object.
A new object with the mapped values.
merge two sets of patches created by immer produce. newPatches take precedent over oldPatches for patches modifying the same path. In the case many consecutive pathces are merged the original model should always be the root model.
Example: A -> B, patches1 B -> C, patches2
mergePatches(A, patches1, patches2) to get patches for A -> C
the original Model the patches should be applied to
immer produce patch list
immer produce patch list (will take precedence)
merged patches
Returns an array of auth modes to try based on the schema, model, and
authenticated user (or lack thereof). Rules are sourced from getAuthRules
and returned in the order they ought to be attempted.
A sorted array of auth modes to attempt.
Notifies the respective listener of the specified type with the message given.
Registers a callback that will be invoked on messageActionTaken events.
The input object that holds the callback handler.
Registers a callback that will be invoked on messageDismissed events.
The input object that holds the callback handler.
Registers a callback that will be invoked on messageDisplayed events.
The input object that holds the callback handler.
Registers a callback that will be invoked on messageReceived events.
The input object that holds the callback handler.
Registers a listener that will be triggered when a notification is opened by user.
Registers a listener that will be triggered when a notification is opened by user.
Registers a listener that will be triggered when a notification is received while app is in a background state.
Registers a listener that will be triggered when a notification is received while app is in a background state.
Registers a listener that will be triggered when a notification is received while app is in a foreground state.
Registers a listener that will be triggered when a notification is received while app is in a foreground state.
Registers a listener that will be triggered when a token is received. A token will be received:
Registers a listener that will be triggered when a token is received. A token will be received:
This utility converts the aws-exports.js file generated by the Amplify CLI into a ResourcesConfig object
consumable by Amplify.
A configuration object from aws-exports.js.
A ResourcesConfig object.
Parse JSON response body to JavaScript object.
Error parser for AWS JSON protocol.
Infer the signing service and region from the given URL, and for REST API only, from the Amplify configuration. It supports raw API Gateway endpoint and AppSync endpoint.
Parse CompleteMultipartUpload API response payload, which may be empty or error indicating internal server error, even when the status code is 200.
POST HTTP request POST HTTP request (server-side) Internal-only REST POST handler to send GraphQL request to given endpoint. By default, it will use IAM to authorize the request. In some auth modes, the IAM auth has to be disabled. Here's how to set up the request auth correctly:
To make the internal post cancellable, you must also call updateRequestToBeCancellable() with the promise from
internal post call and the abort controller supplied to the internal post call.
To make the internal post cancellable, you must also call updateRequestToBeCancellable() with the promise from
internal post call and the abort controller supplied to the internal post call.
Operation for POST request
POST HTTP request POST HTTP request (server-side) Internal-only REST POST handler to send GraphQL request to given endpoint. By default, it will use IAM to authorize the request. In some auth modes, the IAM auth has to be disabled. Here's how to set up the request auth correctly:
To make the internal post cancellable, you must also call updateRequestToBeCancellable() with the promise from
internal post call and the abort controller supplied to the internal post call.
To make the internal post cancellable, you must also call updateRequestToBeCancellable() with the promise from
internal post call and the abort controller supplied to the internal post call.
Operation for POST request
POST HTTP request POST HTTP request (server-side) Internal-only REST POST handler to send GraphQL request to given endpoint. By default, it will use IAM to authorize the request. In some auth modes, the IAM auth has to be disabled. Here's how to set up the request auth correctly:
To make the internal post cancellable, you must also call updateRequestToBeCancellable() with the promise from
internal post call and the abort controller supplied to the internal post call.
To make the internal post cancellable, you must also call updateRequestToBeCancellable() with the promise from
internal post call and the abort controller supplied to the internal post call.
Operation for POST request
POST HTTP request POST HTTP request (server-side) Internal-only REST POST handler to send GraphQL request to given endpoint. By default, it will use IAM to authorize the request. In some auth modes, the IAM auth has to be disabled. Here's how to set up the request auth correctly:
To make the internal post cancellable, you must also call updateRequestToBeCancellable() with the promise from
internal post call and the abort controller supplied to the internal post call.
To make the internal post cancellable, you must also call updateRequestToBeCancellable() with the promise from
internal post call and the abort controller supplied to the internal post call.
Operation for POST request
POST HTTP request POST HTTP request (server-side) Internal-only REST POST handler to send GraphQL request to given endpoint. By default, it will use IAM to authorize the request. In some auth modes, the IAM auth has to be disabled. Here's how to set up the request auth correctly:
To make the internal post cancellable, you must also call updateRequestToBeCancellable() with the promise from
internal post call and the abort controller supplied to the internal post call.
To make the internal post cancellable, you must also call updateRequestToBeCancellable() with the promise from
internal post call and the abort controller supplied to the internal post call.
Operation for POST request
POST HTTP request POST HTTP request (server-side) Internal-only REST POST handler to send GraphQL request to given endpoint. By default, it will use IAM to authorize the request. In some auth modes, the IAM auth has to be disabled. Here's how to set up the request auth correctly:
To make the internal post cancellable, you must also call updateRequestToBeCancellable() with the promise from
internal post call and the abort controller supplied to the internal post call.
To make the internal post cancellable, you must also call updateRequestToBeCancellable() with the promise from
internal post call and the abort controller supplied to the internal post call.
Operation for POST request
Predicate Group
GQL Filter Expression from Predicate Group
Get a function the returns a promise to call putObject API to S3.
Records an Analytic event to Pinpoint. Events will be buffered and periodically sent to Pinpoint.
Records an Analytic event to Pinpoint. Events will be buffered and periodically sent to Pinpoint.
Records an Analytic event to Pinpoint. Events will be buffered and periodically sent to Pinpoint.
Records an Analytic event to Pinpoint. Events will be buffered and periodically sent to Pinpoint.
Records an Analytic event to Pinpoint. Events will be buffered and periodically sent to Pinpoint.
Creates a "seed" predicate that can be used to build an executable condition.
This is used in query(), for example, to seed customer- E.g.,
const p = predicateFor({builder: modelConstructor, schema: modelSchema, pkField: string[]});
p.and(child => [
child.field.eq('whatever'),
child.childModel.childField.eq('whatever else'),
child.childModel.or(child => [
child.otherField.contains('x'),
child.otherField.contains('y'),
child.otherField.contains('z'),
])
])predicateFor() returns objecst with recursive getters. To facilitate this,
a query and tail can be provided to "accumulate" nested conditions.
The ModelMeta used to build child properties.
Scopes the query branch to a field.
A base query to build on. Omit to start a new query.
The point in an existing query to attach new conditions to.
A ModelPredicate (builder) that customers can create queries with. (As shown in function description.)
Creates a link between a key (and generates a key if needed) and an internal
GroupCondition, which allows us to return a key object instead of the gory
conditions details to customers/invoking code.
The internal condition to keep hidden.
The object DataStore will use to find the internal condition. If no key is given, an empty one is created.
Marks device as remembered while authenticated.
selective sync predicate group
name of repeated field | null
Requests notification permissions from your user. By default, Amplify requests all supported permissions but you can choose not to request specific permissions. The resulting promise will resolve to true if requested permissions are granted (or have previously been granted) or false otherwise. Not all specific permissions are supported by platforms your React Native app can run on but will be safely ignored even on those platforms. Currently supported permissions:
alert: When set to true, requests the ability to display notifications to the user.
sound: When set to true, requests the ability to play a sound in response to notifications.
badge: When set to true, requests the ability to update the app's badge.
A promise that resolves to true if requested permissions are granted or have already previously been granted or false otherwise.
Requests notification permissions from your user. By default, Amplify requests all supported permissions but you can choose not to request specific permissions. The resulting promise will resolve to true if requested permissions are granted (or have previously been granted) or false otherwise. Not all specific permissions are supported by platforms your React Native app can run on but will be safely ignored even on those platforms. Currently supported permissions:
alert: When set to true, requests the ability to display notifications to the user.
sound: When set to true, requests the ability to play a sound in response to notifications.
badge: When set to true, requests the ability to update the app's badge.
A promise that resolves to true if requested permissions are granted or have already previously been granted or false otherwise.
Requests notification permissions from your user. By default, Amplify requests all supported permissions but you can choose not to request specific permissions. The resulting promise will resolve to true if requested permissions are granted (or have previously been granted) or false otherwise. Not all specific permissions are supported by platforms your React Native app can run on but will be safely ignored even on those platforms. Currently supported permissions:
alert: When set to true, requests the ability to display notifications to the user.
sound: When set to true, requests the ability to play a sound in response to notifications.
badge: When set to true, requests the ability to update the app's badge.
A promise that resolves to true if requested permissions are granted or have already previously been granted or false otherwise.
Resend the confirmation code while signing up
The ResendSignUpCodeInput object
ResendSignUpCodeOutput
Resets the context
Resets a user's password.
The ResetPasswordInput object.
ResetPasswordOutput
Resolve the REST API request URL by:
Resolves an endpoint id from cache or prepare via updateEndpoint if one does not already exist, which will generate and cache an endpoint id between calls.
resolve the common input options for S3 API handlers from Amplify configuration and library options.
The Amplify instance.
The input options for S3 provider.
The resolved common input options for S3 API handlers.
Retry middleware
It will retry the function if the error is a ResourceNotFoundException and
will clean the device keys stored in the storage mechanism.
The low level function that supports framework specific helpers. It creates an Amplify server context based on the input and runs the operation with injecting the context, and finally returns the result of the operation.
The Amplify resource config.
The Amplify library options.
The operation to run with the server context created from
amplifyConfig and libraryOptions.
The result returned by the operation.
Resends user's confirmation code when updating attributes while authenticated.
The SendUserAttributeVerificationCodeInput object
SendUserAttributeVerificationCodeOutput
Serailize the parameters for configuring the S3 object. Currently used by
putObject and createMultipartUpload API.
Serialize the object key to a URL pathname.
Sets the context of autoSignIn at run time.
Sets the current badge count (the number on the top right corner of your app's icon). Setting the badge count to 0 (zero) will remove the badge from your app's icon. This function is safe to call (but will be ignored) even when your React Native app is running on platforms where badges are not supported.
Sets the current badge count (the number on the top right corner of your app's icon). Setting the badge count to 0 (zero) will remove the badge from your app's icon. This function is safe to call (but will be ignored) even when your React Native app is running on platforms where badges are not supported.
Sets the current badge count (the number on the top right corner of your app's icon). Setting the badge count to 0 (zero) will remove the badge from your app's icon. This function is safe to call (but will be ignored) even when your React Native app is running on platforms where badges are not supported.
Set a conflict handler that will be used to resolve conflicts that may emerge when matching events with synced messages.
Sets custom user agent state which will be appended to applicable requests. Returns a function that can be used to clean up any custom state set with this API.
SetCustomUserAgentInput that defines custom state to apply to the specified APIs.
Sets token.
Sets up TOTP for the user.
SetUpTOTPOutput
Signs a user in
The SignInInput object
SignInOutput
Signs a user in using a custom authentication flow without password
The SignInWithCustomAuthInput object
AuthSignInResult
Signs a user in using a custom authentication flow with SRP
The SignInWithCustomSRPAuthInput object
SignInWithCustomSRPAuthOutput
Signs in a user with OAuth. Redirects the application to an Identity Provider.
The SignInWithRedirectInput object, if empty it will redirect to Cognito HostedUI
Signs a user in
The SignInWithSRPInput object
SignInWithSRPOutput
Signs a user in using USER_PASSWORD_AUTH AuthFlowType
The SignInWithUserPasswordInput object
SignInWithUserPasswordOutput
Signs a user out
The SignOutInput object
Given a HttpRequest, returns a Signature Version 4 signed HttpRequest.
HttpRequest to be signed.
A HttpRequest with authentication headers which can grant temporary access to AWS resources.
Middleware that SigV4 signs request with AWS credentials, and correct system clock offset. This middleware is expected to be placed after retry middleware.
Fetch and persist messages from Pinpoint campaigns. Calling this API is necessary to trigger InApp messages on the device.
A promise that will resolve when the operation is complete.
Transforms a user attributes object into an array of AttributeType objects.
user attributes to be mapped to AttributeType objects.
an array of AttributeType objects.
Transforms an array of AttributeType objects into a user attributes object.
an array of AttributeType objects.
AuthUserAttributes object.
Make REST API call with best-effort IAM auth.
Amplify instance to to resolve credentials and tokens. Should use different instance in client-side and SSR
Options accepted from public API options when calling the handlers.
Internal-only options enable IAM auth as well as to to overwrite the IAM signing service and region. If specified, and NONE of API Key header or Auth header is present, IAM auth will be used.
Get the first error reason of an observable. Allows for error maps to be easily applied to observable errors
an error from ZenObservable subscribe error callback
Updates the MFA preference of the user.
The UpdateMFAPreferenceInput object.
Updates user's password while authenticated.
The UpdatePasswordInput object.
Updates a provider's trackers as appropriate for the provided auto-track configuration.
MUST be used to make a promise including internal post API call cancellable.
Updates user's attribute while authenticated.
The UpdateUserAttributeInput object
UpdateUserAttributeOutput
Updates user's attributes while authenticated.
The UpdateUserAttributesInput object
UpdateUserAttributesOutput
Upload data to specified S3 object. By default, it uses single PUT operation to upload if the data is less than 5MB. Otherwise, it uses multipart upload to upload the data. If the data length is unknown, it uses multipart upload.
Limitations:
The UploadDataInput object.
A cancelable and resumable task exposing result promise from result
property.
Middleware injects user agent string to specified header(default to 'x-amz-user-agent'), if the header is not set already.
TODO: incorporate new user agent design
Validates tracker configuration. Validates tracker configuration.
Validates tracker configuration. Validates tracker configuration.
Verifies an OTP code retrieved from an associated authentication app.
The VerifyTOTPSetupInput
Cache the payload of a response body. It allows multiple calls to the body, for example, when reading the body in both retry decider and error deserializer. Caching body is allowed here because we call the body accessor(blob(), json(), etc.) when body is small or streaming implementation is not available(RN).
Base transfer handler implementation using XMLHttpRequest to support upload and download progress events.
The request object.
The request options.
A promise that will be resolved with the response object.
This utility is intended to be deprecated and replaced by signRequest and presignUrl functions from
clients/middleware/signing/signer/signatureV4.
TODO: refactor the logics here into signRequest and presignUrl functions and remove this class.
Milliseconds to offset the date to compensate for clock skew between device & services
Clock offset in milliseconds
Clock offset in milliseconds
Default cache config
Default partition for AWS services. This is used when the region is not provided or the region is not recognized.
Maps operators to negated operators. Used to facilitate propagation of negation down a tree of conditions.
Pure JS XML parser that can be used in Non-browser environments, like React Native and Node.js. This is the same
XML parser implementation as used in AWS SDK S3 client. It depends on pure JavaScript XML parser library
fast-xml-parser.
Drop-in replacement for fast-xml-parser's XmlParser class used in the AWS SDK S3 client XML deserializer. This
implementation is not tested against the full xml conformance test suite. It is only tested against the XML responses
from S3. This implementation requires the DOMParser class in the runtime.
This data is adapted from the partition file from AWS SDK shared utilities but remove some contents for bundle size
concern. Information removed are dualStackDnsSuffix, supportDualStack, supportFIPS, restricted partitions, and
list of regions for each partition other than global regions.
Optional API key string. Required only if the auth mode is 'apiKey'.